{% extends "base.html" %}
{% block title %}{{ siteName }} - Library{% endblock %}
{% block content %}
	<div>
		Personal Library: This page displays all the decks that you created / studied.
	</div>
	{% if authored_decks %}
		<div class="personalLibrary">
			<form id='authored_decks_form' action='/' method='POST'>
			<table class='stripeMe aslTable'>
				<tr>
					<th class="personalLibraryHeader" colspan='6'>Decks that you created:</th>
				</tr>
				<tr>
					<th style='width:20px'>&nbsp;</th>
					<th>Title</th>
					<th>Description</th>
					<th style='width:50px'>Status</th>
					<th style='width:90px'>Member count</th>
					<th style='width:70px'>Entry count</th>
				</tr>
				{% for data in authored_decks %}
				<tr style='vertical-align:top'>
					<td><input class='authored_checkbox' type='checkbox' name='cb' value='{{data.key|safe}}'/></td>
					<td><a class='setlink NeedMyTooltip library_authored_decks' href='/ajax/set/subscribe.html?setKey={{ data.key|safe }}' id='library_authored_deck_link{{forloop.counter}}'>{{ data.title|safe }}</a></td>
					<td>{{data.description|safe}}</td>
					<td>
						<span class='being_used_but_hidden library_hidden_setKey'>{{ data.key|safe }}</span>
						{% if data.current %}
							<a href='/' class='NeedMyTooltip Following LibraryStatus' id='library_authored_status{{forloop.counter}}'><img src='/images/status_green.png'/></a>
						{% else %}
							<a href='/' class='NeedMyTooltip LibraryStatus' id='library_authored_status{{forloop.counter}}'><img src='/images/status_gray.png'/></a>
						{% endif %}
					</td>
					<td class='subscriptionCount'>{{data.subscriptionCount}}</td>
					<td class='authoredDecksEntryCount'>{{data.entryCount}}</td>
				</tr>
				{% endfor %}
			</table>
			</form>
			<div style='padding-left:10px; padding-bottom:10px; padding-top:10px'>
				<span class='button NeedMyTooltip' id='library_delete_authored_decks'>Delete</span>
			</div>
			<div style='display:none;' id='library_delete_authored_decks_tooltip'>
				Delete selected decks.
			</div>
		</div>
	{% endif %}

	{% if not_authored_decks %}
		<div class="personalLibrary" style='margin-top: 10px'>
			<form id='not_authored_decks_form' action='/' method='POST'>
			<table class='stripeMe aslTable'>
				<tr>
					<th class="personalLibraryHeader" colspan='7'>Decks that were authored by other users:</th>
				</tr>
				<tr>
					<th style='width:20px'>&nbsp;</th>
					<th>Title</th>
					<th>Description</th>
					<th>Author</th>
					<th style='width:50px'>Status</th>
					<th style='width:90px'>Member count</th>
					<th style='width:70px'>Entry count</th>
				</tr>
				{% for data in not_authored_decks %}
				<tr style='vertical-align:top'>
					<td><input class='not_authored_checkbox' type='checkbox' name='cb' value='{{data.key|safe}}'/></td>
					<td><a class='setlink NeedMyTooltip library_not_authored_decks' id='library_not_authored_deck_link{{forloop.counter}}' href='/ajax/set/subscribe.html?setKey={{ data.key|safe }}'>{{ data.title|safe }}</a></td>
					<td>{{data.description|safe}}</td>
					<td>{{data.author|safe}}</td>
					<td>
						<span class='being_used_but_hidden library_hidden_setKey'>{{ data.key|safe }}</span>
						{% if data.current %}
							<a href='/' class='NeedMyTooltip Following LibraryStatus' id='library_not_authored_status{{forloop.counter}}'><img src='/images/status_green.png'/></a>
						{% else %}
							<a href='/' class='NeedMyTooltip LibraryStatus' id='library_not_authored_status{{forloop.counter}}'><img src='/images/status_gray.png'/></a>
						{% endif %}
					</td>
					<td class='subscriptionCount'>{{data.subscriptionCount}}</td>
					<td>{{data.entryCount}}</td>
				</tr>
				{% endfor %}
			</table>
			</form>
			<div style='padding-left:10px; padding-bottom:10px; padding-top:10px'>
				<span class='button NeedMyTooltip' id='library_delete_not_authored_decks'>Delete</span>
			</div>
			<div style='display:none; width:260px' id='library_delete_not_authored_decks_tooltip'>
				Delete / Unfollow selected decks completely.  After you unfollow a deck, we still display it here just in case you need it again later.  This button will remove selected decks from this page completely.
			</div>
		</div>
	{% endif %}

	{% if authored_decks or not_authored_decks %}
	{% else %}
		<p>Your personal library is currently empty.</p>
	{% endif %}
{% endblock %}

